//package me.firstapp.service.weixin.member.impl;
//
//import java.util.List;
//import java.util.Map;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import me.firstapp.common.exception.ServiceException;
//import me.firstapp.common.exception.StatusHouse;
//import me.firstapp.common.utils.Page;
//import me.firstapp.common.utils.StrUtils;
//import me.firstapp.module.weixin.member.Member;
//import me.firstapp.module.weixin.member.Partner;
//import me.firstapp.repository.weixin.member.MemberRepository;
//import me.firstapp.repository.weixin.member.PartnerRepository;
//import me.firstapp.service.weixin.member.PartnerService;
//
//@Service
//public class PartnerServiceImpl implements PartnerService {
//
//	@Autowired
//	private PartnerRepository partnerRepository;
//
//	@Autowired
//	private MemberRepository memberRepository;
//
//	@Override
//	public Page<Partner> findPartnerPage(Integer pageNo, Integer pageSize, Map<String, Object> searchParams,
//			String sortParam, String sortType) {
//		return partnerRepository.findPartnerPage(pageNo, pageSize, searchParams, sortParam, sortType);
//	}
//
//	@Override
//	public Partner executeAddAgents(String openId, int counts) {
//		Member member = memberRepository.findMemberByOpenId(openId);
//		Partner partner = partnerRepository.findPartnerByOpenId(openId);
//		if (null == member || null == partner) {
//			throw new ServiceException(StatusHouse.STATUS_MEMBER_NOT_EXIST);
//		}
////		if (Member.VIP_LEVEL_PARTNER != member.getVipLevel()) {
////			throw new ServiceException("error", "用户不是合伙人");
////		}
//		List<Member> members = memberRepository.findNoPartnerAgentMembers(counts);
//		for (Member member2 : members) {
//			member2.setPartnerCardNo(partner.getCardNo());
//			member2.setPartnerOpenId(partner.getOpenId());
//			memberRepository.update(member2);
//		}
//		partner.setAgentCounts(partner.getAgentCounts() + members.size());
//		partnerRepository.update(partner);
//		return partner;
//	}
//
//	@Override
//	public Partner executeUpdate(String openId, String realName, String idCard, String qq, String weixin, String mobile,
//			String email, String address, String remark) {
//		Partner partner = partnerRepository.findPartnerByOpenId(openId);
//		if (null == partner) {
//			throw new ServiceException(StatusHouse.STATUS_MEMBER_NOT_EXIST);
//		}
//		if (StrUtils.isNotNULL(realName)) {
//			partner.setRealName(realName);
//		}
//		if (StrUtils.isNotNULL(idCard)) {
//			partner.setIdCard(idCard);
//		}
//		if (StrUtils.isNotNULL(qq)) {
//			partner.setQq(qq);
//		}
//		if (StrUtils.isNotNULL(weixin)) {
//			partner.setWeixin(weixin);
//		}
//		if (StrUtils.isNotNULL(mobile)) {
//			partner.setMobile(mobile);
//		}
//		if (StrUtils.isNotNULL(email)) {
//			partner.setEmail(email);
//		}
//		if (StrUtils.isNotNULL(address)) {
//			partner.setAddress(address);
//		}
//		if (StrUtils.isNotNULL(remark)) {
//			partner.setRemark(remark);
//		}
//		partnerRepository.update(partner);
//		return partner;
//	}
//
//	@Override
//	public Partner findPartnerByOpenId(String openId) {
//		return partnerRepository.findPartnerByOpenId(openId);
//	}
//
//}
